Refactor rectangle and box types #41231
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: Infrastructure "Refactor rectangle and box types"
Purpose of change
Previously rectangle and box were just a min and max. Determining whether the upper bound should be considered to be inclusive was done by which function was called on it.
I now regret that design choice, and am changing it.
Describe the solution
Now the inclusive vs half-open is part of the rectangle or box type, and the functions are generic.
This leads to less repetition in the code.
Also, the next step is to make it possible to iterate over rectangles (to simplify a bunch of our nested for loops), and this design fits much better for that.
Describe alternatives you've considered
Leaving as-is.
Testing
Unit tests.
Additional context
Indirectly part of the effort towards #32017.